﻿Public Class BangItem
    Private RemTime As Integer
    Dim MaxiTime As Integer = RemTime + 1
    Private Borders As String = MyBorder.BottomOnly

    Enum MyBorder
        TopOnly
        BottomOnly
        Both
        None
    End Enum

#Region "Properties"
    ''' <summary>
    ''' Gets or Sets the text for first language.
    ''' example: Isha,شێوان,عشاء etc.
    ''' </summary>
    ''' <value>Name of the Salat in the first language.</value>
    ''' <returns>Current name of Salat in the first language.</returns>
    ''' <remarks></remarks>
    Public Property Lang1() As String
        Get
            Return lbl1.Text
        End Get
        Set(value As String)
            lbl1.Text = value
        End Set
    End Property
    ''' <summary>
    ''' Gets the text alignment of the first language text.
    ''' </summary>
    ''' <value>new textalignment</value>
    ''' <returns>current textalignment</returns>
    ''' <remarks></remarks>
    Public Property Lang1Alignment() As ContentAlignment
        Get
            Return lbl1.TextAlign
        End Get
        Set(value As ContentAlignment)
            lbl1.TextAlign = value
        End Set
    End Property
    ''' <summary>
    ''' Gets or Sets the text for second language.
    ''' example: Isha,شێوان,عشاء etc.
    ''' </summary>
    ''' <value>Name of the Salat in the second language.</value>
    ''' <returns>Current name of Salat in the second language.</returns>
    ''' <remarks></remarks>
    Public Property Lang2() As String
        Get
            Return Lbl2.Text
        End Get
        Set(value As String)
            Lbl2.Text = value
        End Set
    End Property
    ''' <summary>
    ''' Gets the text alignment of the second language text.
    ''' </summary>
    ''' <value>new textalignment</value>
    ''' <returns>current textalignment</returns>
    ''' <remarks></remarks>
    Public Property Lang2Alignment() As ContentAlignment
        Get
            Return Lbl2.TextAlign
        End Get
        Set(value As ContentAlignment)
            Lbl2.TextAlign = value
        End Set
    End Property
    ''' <summary>
    ''' Get the time for salat
    ''' </summary>
    ''' <value>New time of salat</value>
    ''' <returns>current time of salat</returns>
    ''' <remarks></remarks>
    Public Property Time() As String
        Get
            Return lbltime.Text
        End Get
        Set(value As String)
            lbltime.Text = value
        End Set
    End Property

    Public Property BorderColor() As Color
        Get
            Return BorderTop.BackColor
        End Get
        Set(value As Color)
            BorderTop.BackColor = value
            BorderBottom.BackColor = value

        End Set
    End Property

    ''' <summary>
    ''' Gets or sets the state of the control
    ''' </summary>
    ''' <remarks></remarks>
    Private MeActive As Boolean
    Public Property Active() As Boolean
        Get
            Return MeActive
        End Get
        Set(value As Boolean)
            MeActive = value
        End Set
    End Property
    Public Property TextColor As Boolean
        Get
            Return MeActive
        End Get
        Set(value As Boolean)
            MeActive = value
        End Set
    End Property
    Public Property Border As MyBorder
        Get
            Return Borders
        End Get
        Set(value As MyBorder)
            Borders = value
        End Set
    End Property
    Public Property RemainingTime As Integer
        Get
            Return RemTime
        End Get
        Set(value As Integer)
            RemTime = value
        End Set
    End Property
    Public Property MaxTime As Integer
        Get
            Return MaxiTime
        End Get
        Set(value As Integer)
            MaxiTime = value
        End Set
    End Property
#End Region

    Private Sub TmrCheck_Tick(sender As Object, e As EventArgs) Handles TmrCheck.Tick

        If MeActive = True Then

                NextPrayerPrgss.Show()
                NextPrayerPrgss.Maximum = MaxTime
                NextPrayerPrgss.Value = RemainingTime
                NextPrayerPrgss.Width = Me.Width

     
        Else
            NextPrayerPrgss.Hide()
        End If

        Select Case Borders
            Case MyBorder.Both
                BorderTop.Visible = True
                BorderBottom.Visible = True
            Case MyBorder.BottomOnly
                BorderTop.Visible = False
                BorderBottom.Visible = True
            Case MyBorder.TopOnly
                BorderTop.Visible = True
                BorderBottom.Visible = False
            Case MyBorder.None
                BorderTop.Visible = False
                BorderBottom.Visible = False
        End Select

    End Sub

    Private Sub NextPrayerPrgss_MouseHover(sender As Object, e As EventArgs) Handles NextPrayerPrgss.MouseHover
        Dim tooltip As New ToolTip()
        tooltip.SetToolTip(NextPrayerPrgss, (GetRemainingTimeInText(MaxTime - RemainingTime)))

     
    End Sub
    Function GetRemainingTimeInText(ByVal remainingtime As Integer)

        Dim remtm As TimeSpan = New TimeSpan(0, 0, RemainingTime)
        Return (remtm.Hours & ":" & remtm.Minutes & ":" & remtm.Seconds)

    End Function

    Private Sub lbltime_Click(sender As Object, e As EventArgs) Handles lbltime.Click

    End Sub


    Private Sub lbl1_Click(sender As Object, e As EventArgs) Handles lbl1.Click

    End Sub
    Private Sub Lbl2_Click(sender As Object, e As EventArgs) Handles Lbl2.Click

    End Sub

    Private Sub BorderTop_Click(sender As Object, e As EventArgs) Handles BorderTop.Click

    End Sub
End Class
